import { AxiosPromise } from 'axios'
import request from '@/hooks/utils/http'

export class SysDeptService {
  /**
   * 删除数据集定义
   */
  static del = (ids: Array<string | number> | string | number) => {
    return request({
      url: '/sys/dept/' + ids,
      method: 'delete'
    })
  }
  /**
   * 新增数据集定义
   */
  static add = (data: any) => {
    return request({
      url: '/sys/dept',
      method: 'post',
      data: data
    })
  }
  /**
   * 修改数据集定义
   * @param data
   */
  static update = (data: any) => {
    return request({
      url: '/sys/dept',
      method: 'put',
      data: data
    })
  }
  /**
   * 查询数据集定义详细
   */
  static get = (id: string | number): AxiosPromise<SysDeptVO> => {
    return request({
      url: '/sys/dept/' + id,
      method: 'get'
    })
  }
  /**
   * 获取数据集定义列表
   */
  static list = (query: SysDeptQuery): AxiosPromise<SysDeptVO[]> => {
    return request({
      url: '/sys/dept/list',
      method: 'get',
      params: query
    })
  }
}

export interface SysDeptVO extends BaseEntity {
  id: string | number
  deptId: long
  deptName: string
  deptCategory: string
  parentId: long
  orderNum: integer
  status: string
  ancestors: string
}

export interface SysDeptQuery extends PageQuery {
  deptId: long
  deptName: string
  deptCategory: string
  parentId: long
  orderNum: integer
  status: string
  ancestors: string
}

export interface SysDeptForm {
  id: string | number
  deptId: long
  deptName: string
  deptCategory: string
  parentId: long
  orderNum: integer
  status: string
  ancestors: string
}
